home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------
- *
- * File: SetFolderIconAA.c - C Source
- *
- * Author: Deric Horn
- *
- * Action atom to set the custom icon finder flag of the parent folder of the
- * specified file, infs. It also clears the init'd bit so the finder knows
- * to update the desktop/display information.
- *
- * History: <1> (12/2/94) Created this file.
- *
- *----------------------------------------------------------------------------*/
-
- #include <Types.h>
- #include <Resources.h>
- #include "ActionAtomIntf.h"
- #include "AtomUtils.h"
-
- pascal long SETFOLDERICON(AAPBRecPtr myAAPBPtr)
- {
- OSErr err;
- intfHdl resH;
- CInfoPBRec info;
- DInfo *myDirInfo;
- Str255 pathStorage;
- long theDirID;
-
- if (myAAPBPtr->whichStage == after)
- {
- resH = (intfHdl)Get1Resource('intf', myAAPBPtr->aaRefCon);
- if (resH) {
- HLock( (Handle)resH );
- if (StripFileName((*resH)->pathName) == noErr)
- {
- if ( (*resH)->pathName[1] != ':' ) // Found SpecialFolder
- {
- theDirID = DirIDFromSpecialPath( (*resH)->pathName, myAAPBPtr->targetVRefNum );
- PathFromSpecialPath( pathStorage, (*resH)->pathName );
- }
- else
- {
- // This was a target pathname like ':Folder 1:FileName', no chopping necessary
-
- BlockMove(&((**resH).pathName), pathStorage, (**resH).pathName[0] + 1);
-
- // The target was off of the root, not the blessed, so adjust the dirID we'll look for the file
- // to the root of the target volume.
-
- theDirID = 0;
- }
-
- info.dirInfo.ioCompletion = nil;
- info.dirInfo.ioVRefNum = myAAPBPtr->targetVRefNum;
- info.dirInfo.ioNamePtr = pathStorage;
- info.dirInfo.ioFDirIndex = 0;
- info.dirInfo.ioDrDirID = theDirID;
-
- if (PBGetCatInfo(&info, false) == noErr) {
- myDirInfo = &info.dirInfo.ioDrUsrWds;
- myDirInfo->frFlags &= 0xFEFF;
- // clear the init'd bit
- myDirInfo->frFlags |= 0x0400;
- // set the "Use Custom Folder Icon" bit
-
- // now that the ioDrDirID field is filled in corectly
- // let's use it to identify the directory instead of the name ptr.
- info.dirInfo.ioNamePtr = nil;
- info.dirInfo.ioFDirIndex = -1;
- err = PBSetCatInfo(&info,false);
- }
- }
- HUnlock((Handle)resH);
- ReleaseResource((Handle)resH);
- }
- }
- return err; // Since the installation reached this point, dont abort
- }
-
-
-
-